package com.xiongda;

import com.xiongda.exception.MyException;
import org.junit.Test;

import java.util.Scanner;
import java.util.regex.Pattern;

/**
 * Created by Administrator on 2017/11/9.
 */
public class test {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            String str = scanner.next();
            if (!Pattern.matches("^\\d+(\\.\\d+)?$", str))
                throw new MyException("参数错误");
            StringBuffer sb = new StringBuffer(str);
            if (sb.indexOf(".") != -1){
                while (true) {
                    sb = sb.charAt(sb.length() - 1) == '0' ? sb.deleteCharAt(sb.length() - 1) : sb;
                    if (sb.charAt(sb.length() - 1) != '0') {
                        sb = sb.charAt(sb.length() - 1) == '.' ? sb.deleteCharAt(sb.length() - 1) : sb;
                        break;
                    }
                }
            }
            str = sb.toString();
            System.out.println(str);
        }
    }

    @Test
    public void demo() {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            String str = scanner.next();
            StringBuffer sb = new StringBuffer(str);
            if (sb.indexOf(".") != -1){
                while (true) {
                    sb = sb.charAt(sb.length() - 1) == '0' ? sb.deleteCharAt(sb.length() - 1) : sb;
                    if (sb.charAt(sb.length() - 1) != 0) {
                        sb = sb.charAt(sb.length() - 1) == '.' ? sb.deleteCharAt(sb.length() - 1) : sb;
                        break;
                    }
                }
            }
            str = sb.toString();
            System.out.println(str);
        }
    }
}